<template>
    <div class="likeItem" @click="go">
        <div class="user">
            <img :src="item.avatar" class="user-avatar" alt="" />
            {{ item.uername }}
            <div class="title">
                <!-- 在问题<span>《做会计有提前年度》</span>中写了一条新评论 -->
                {{ item.info }}
            </div>
        </div>
        <div v-if="tabIndex == 0" class="text">
            {{ item.title }}
        </div>
        <div class="time">{{ getTime(item.createtime*1000) }}</div>
    </div>
</template>
  
<script>
import { getTime } from "@/assets/utils/utils";
export default {
    name: "likeItem",
    props: {
        item: {
            type: Object,
            default: () => {
                return {};
            },
        },
        tabIndex: {
            type: Number,
            default: 0,
        },
    },
    data() {
        return {
            getTime: getTime,
        };
    },
    computed: {},
    mounted() {},
    methods: {
        go() {
            let { href } = this.$router.resolve({
                    path: "/cswd/"+ this.item.quiz_id+'.html',
            });
            window.open(href, "_blank");
        },
    },
};
</script>
<style lang="scss" scoped>
.likeItem {
    padding: 30px 40px 0;
    padding-bottom: 22px;
    border-bottom: 1px solid #ebebeb;
    cursor: pointer;
    &:hover {
        background: #f7f9fb;
        .text{
            color: #1C87F3;
        }
    }
}
.text {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 18px;
    color: #333333;
    margin: 11px 0 10px;
}
.user {
    display: flex;
    font-size: 14px;
    color: #333333;
    display: flex;
    align-items: center;
    .user-avatar {
        width: 30px;
        height: 30px;
        border-radius: 30px;
        margin-right: 9px;
    }
    .title {
        padding-left: 14px;
        font-size: 14px;
        color: #999999;
        span {
            color: #1c87f3;
        }
    }
}
.time {
    margin-top: 14px;
    font-size: 12px;
    color: #999999;
}
</style>
  